<html>

<head>

<link rel="stylesheet" type="text/css" href="${def:context}/default.css" />

<!--biblioteca generica JS/Dinamica-->
<script type="text/javascript" src="${def:context}/action/script">
	</script>
<title>绑定房主</title>

</head>

<body>

<!--banner-->
<div class="banner" style="height: 15px; margin-bottom: 0px; font-weight: normal">
	<div style="float: left">绑定房主</div>
	<div style="float: right">
		<img src="${def:context}/images/close.gif" class="button" onclick="parent.pickClose()" title="关闭">
	</div>
</div>
<center>
<form name="form2" onsubmit="return search()" style="margin-top:0px;margin-bottom:0px;">
<TABLE class="table_comm" cellSpacing=0 cellPadding=0 width="100%" border=0>
	<tr>
		<td class="th20">
			姓名
		</td>
		<td>
			<input name="master_name" size="6" type="text" value="" maxlength="50">
		</td>
		<td class="th20">
			拼音快捷
		</td>
		<td>
			<input name="master_chars" size="6" type="text" value="" maxlength="50">
		</td>
		<td align="center"><input type="submit" class="cmd" value="查询"></td>
	</tr>
</table>
</form>

<div id="status" class="alert" style="display: none; color: gray; width: 60%; font-weight: normal; font-family: Arial; margin-top: 10px">
	<img src="${def:context}/images/progress.gif"> 请等待
</div>

<!--panel de respuesta AJAX-->
<form name="form1" onsubmit="return update()" style="margin-top:0px;margin-bottom:0px;">
<div id="response" style="display: none; width: 100%; margin-top: 7px">
</div>
<input name="house_tuid" type="hidden" value="${fld:house_tuid}">
<input name="house_name" type="hidden" value="${fld:house_name}">
</form>

</center>

</body>

<!--codigo de soporte del template-->
<script type="text/javascript">
		var currstyle = "";

		function search()
		{
			return ajaxCall(	httpMethod="POST", 
								uri="${def:actionroot}/search", 
								divResponse="response", 
								divProgress="status", 
								formName="form2", 
								afterResponseFn=null, 
								onErrorFn=null);
		
		}

		function viewPage()
		{
			var url = "${def:actionroot}/view";
			gotoPage(url);
		}

		//resaltar row del grid
		function rowOn(obj) {
			currStyle = obj.className;
			obj.className="hilite";
		}
		
		//restaurar color normal del row del grid
		function rowOff(obj) {
			obj.className=currStyle
		}
		
		function update(){
			if(!CheckRadio("placement","请选择房主","","form1")) return false;
			return ajaxCall(	httpMethod="POST", 
                            uri="${def:actionroot}/update", 
                            divResponse="response", 
                            divProgress="status", 
                            formName="form1", 
                            afterResponseFn=null, 
                            onErrorFn=null);
		}

		function CheckRadio(val,msg1,msg2,formObj)
		{
			//表单对象，如果为null，默认为“formEditor”
			var formTarget=(formObj==null || formObj=="" || typeof(formObj)=="undefined")? "formEditor":formObj;

			var is_radio=document.forms[formTarget].elements[val];
			var s_msg1=(msg1==null || msg1=="")? "请选择 radio!":msg1;
			var s_msg2=(msg2==null || msg2=="")? "没有可选的 radio!":msg2;

			if(is_radio)
			{
				 if (document.forms[formTarget].elements[val].value != null)
				 {
					if (document.forms[formTarget].elements[val].checked)
					{
						return true;
					}
					else
					{
						alert(s_msg1);
						return false;
					}
				 }
				 else
				 {
					var check_length = document.forms[formTarget].elements[val].length;
					var i_count=0
					for(var i=0;i<check_length;i++)
					{
						if (document.forms[formTarget].elements[val][i].checked)
						{
							i_count=i_count+1;
							return true;
						}
					}
					if(i_count==0)
					{
						alert(s_msg1);
						return false;
					}
				 }
			}
		}
</script>


</html>
